/*
 * @version: 1.0
 * @Author: zhl
 * @Date: 2021-09-28 14:04:24
 * @LastEditors: zhl
 * @LastEditTime: 2021-09-29 20:08:55
 * @Description: 文件实现描述
 */
#ifndef __HANDLE_DATA_H__
#define __HANDLE_DATA_H__

#include <string>
#include <iostream>
#include <memory>

#include "Data.h"
#include "CMosquittoManager.h"
#include "protocol_engine_config.h"
#include "global_data_struct.h"



class HandleData{

private:
    static HandleData c_hd;

    template<typename T>
    std::string get_real_value(DLT698_POINT &point, T value);

public:
    HandleData();
    ~HandleData();

    static HandleData &getInstance();

    std::string doubleToStr(const char *fmt, const double &val);
    int  handle(std::shared_ptr<CMosquittoManager> mm, Data &data, TASK_PARAMS *params);
    std::string get_data_value(std::shared_ptr<CMosquittoManager> mm, int64_t dev_id, uint8_t *value, int len, DLT698_POINT point, int data_type);
    int  handle_alert(int64_t dev_id, int64_t point_id, std::string oadv, std::string alert_desc);
    int  restore_alert(int64_t dev_id, int64_t point_id, std::string oadv);
    int  parse_linkage(std::shared_ptr<CMosquittoManager> mm,DLT698_POINT &point, int64_t dev_id, std::string value);
    int  is_linkage(std::string op, std::string value1, std::string value2);
};









#endif /* __HANDLE_DATA_H__ */